package guicommon.controls.handlers;

import guicommon.controls.handlers.MouseEventArgs;
import java.lang.reflect.Constructor;
import java.util.Hashtable;

public abstract class EventArgs {

    protected static final Character SEPARATOR = '$';

    private static final Class[] paramTypesForEventArgsConstructor = new Class[] { String.class };

    protected EventArgs(String string) {
        
    }

    public abstract String ToString();

    public static EventArgs EventArgsFactory(String args) {
        try {
            String type = args.substring(0, args.indexOf(SEPARATOR));
            args = args.substring(args.indexOf(SEPARATOR) + 1);
            Class needClass = Class.forName(type);
            Constructor constructor = needClass.getDeclaredConstructor(paramTypesForEventArgsConstructor);
            if (!constructor.isAccessible()) {
                constructor.setAccessible(true);
            }
            return (EventArgs) constructor.newInstance(args);
        } catch (Exception ex) {
            return null;
        }
    }
}
